package com.zc.app.sys.service;

import com.github.pagehelper.PageHelper;
import com.zc.app.sys.dao.mapper.SystemRoleMenuPeerMapper;
import com.zc.app.sys.dao.peer.SystemRoleMenuPeer;
import com.zc.framework.common.bean.MyPageInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by zc on 2016/11/23.
 */
@Service
public class SystemRoleMenuService {

    private static Logger logger = LogManager.getLogger(SystemRoleMenuService.class);

    @Autowired
    private SystemRoleMenuPeerMapper systemRoleMenuPeerMapper;


    public int createRoleMenu(SystemRoleMenuPeer roleMenuPeer) {
        return systemRoleMenuPeerMapper.insert(roleMenuPeer);
    }

    public int updateByPrimaryKey(SystemRoleMenuPeer record) {
        return systemRoleMenuPeerMapper.updateByPrimaryKey(record);
    }

    public List<SystemRoleMenuPeer> selectMenuListByRoleId(List<Integer> roleIdList) {
        return systemRoleMenuPeerMapper.selectMenuListByRoleId(roleIdList);
    }

    public SystemRoleMenuPeer selectByPrimaryKey(Integer roleMenuId) {
        return systemRoleMenuPeerMapper.selectByPrimaryKey(roleMenuId);
    }


    public MyPageInfo<SystemRoleMenuPeer> queryPageRoleMenus(SystemRoleMenuPeer roleMenuPeer, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return new MyPageInfo<SystemRoleMenuPeer>(systemRoleMenuPeerMapper.queryList(roleMenuPeer));
    }

}
